<?php

function dangnhap($tentk,$maloaitk) {

    if ($tentk != NULL) {
        ?>
        <header id="login-menu" >
            <li id="buttonlogout" >Thoát  </li>                          
            <li id="buttontaikhoan"><?php echo $tentk; ?> </li>              
        </header>

        <!-- begin form taikhoan -->
        <div id="login" class="main">
            <form id="form-taikhoan" method="post" action="<?= base_url("index.php/taikhoan/dangnhap") ?> " >
                <h3> Quản lý tài khoản</h3>
                <p class="line1"></p>
                <a href="<?= base_url("index.php/welcome/doimatkhau") ?>"><p>Đổi mật khẩu</p></a>
                <p class="line1"></p>
                <p>Cập nhật thông tin tài khoản</p>
                <p class="line1"></p>
                 <a  href="<?= base_url("index.php/thanhtoan/lichsugd") ?>"><p>Xem lịch sử giao dịch</p></a>
                 
                 <?php  
                     if($maloaitk=="LTK01")
                     {?>
                  <p class="line1"></p>
                 <a  href="<?= base_url("index.php/admin") ?>"><p>Quản trị</p></a>
                 <?php } ?>
            </form>
            <!-- begin list gio hang -->
            <div id="listgiohang" >

            </div>
            <!-- end list gio hang -->
        </div>
        <!-- end form taikhoan -->
        <?php
    } else {
        ?>
        <header id="login-menu" class="main" >
            <li ><a style ="color: beige;"href="<?php echo base_url(); ?>index.php/welcome/dangky">đăng ký</a></li>
            <li id="buttonlogin" >đăng nhập  </li> 


        </header>      
        <!-- begin form login -->
        <div id="login" class="main">
            <form id="form-login" method="post" action="<?= base_url("index.php/taikhoan/dangnhap") ?> " >
                <div id="tamgiac_login"></div>

                <h2>Đăng nhập</h2>
                <div id="line"></div>
                <p class="email">Email:</p>
                <input type="text" id="input1" name="email_login" size="30" value="" class="input_login" required="">
                <div class="arrow" style="display:none"></div>                              
                <p class="email">Mật khẩu:</p>
                <input type="password" id="input2" name="pass_login" size="30" value="" class="input_login">
                <div class="arrow" style="display:none"></div>
                <div id="chexbox">
                    <input class="valign checkbox" type="checkbox" name="remember_me" id="remember_me_popup" value="Y" checked="checked">
                    <label for="remember_me_popup" class="valign">Nhớ trạng thái đăng nhập</label>
                    <p id="error_catch" style="display:none;" class="error"></p>
                </div>
                <button class="submit" type="submit" id="btn_login">Đăng nhập</button>
                <span id="span_quenmatkhau">[</span> <a href="<?php echo base_url(); ?>index.php/welcome/quenmk" class="forgotpass">Quên mật khẩu?</a> <span>]</span><br>
            </form>
            <!-- begin list gio hang -->
            <div id="listgiohang" >

            </div>
            <!-- end list gio hang -->
        </div>
        <!-- end form login -->

        <?php
    }
}
?>
<!-- end function --->

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
        <title><?php echo (isset($title)) ? $title : "AIO Book store | Nhà sách online" ?> </title>

        <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>public/css/style.css" />
        <script src="<?php echo base_url(); ?>public/js/jquery.js"></script>
        <script src="<?php echo base_url(); ?>public/js/turn.js"></script>
        <script src="<?php echo base_url(); ?>public/js/js.js"></script>
        <script src="<?php echo base_url(); ?>public/js/bPopup.js" type="text/javascript"></script>  
        <script src="<?php echo base_url(); ?>public/js/jquery-ui.min.js" type="text/javascript"></script>  
        <script src="<?php echo base_url(); ?>public/booklet/jquery.easing.1.3.js" type="text/javascript"></script>
        <script src="<?php echo base_url(); ?>public/booklet/jquery.booklet.latest.js" type="text/javascript"></script>

        <link href="<?php echo base_url(); ?>public/booklet/jquery.booklet.latest.css" type="text/css" rel="stylesheet" media="screen, projection, tv" />
        <!--
        <script src="echo base_url(); ?>public/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
        <link href=" echo base_url(); ?>public/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet" media="screen, projection, tv" />
        --->
        <script> globalurl = "<?= base_url(); ?>"</script>
    </head>
    <body>
        <div>
            <div id="wrapper">
                <div id="top" class="clr">
                    <?php
                    
                    if (isset($tentk))
                        dangnhap($tentk,$maloaitk);
                    else
                        dangnhap(null,null);
                    ?>
                    <div id="top-main">
                        <div>
                            <a id="logo" href="<?= base_url(); ?>" ><img src="<?php echo base_url(); ?>public/images/aio.png" alt="logo" /></a>			

                            <nav id="nav" class="">

                                <li class="menu">
                                    <a href="#" class="item">
                                        <span> 
                                            <span class="mn">danh mục</span>
                                        </span>
                                    </a>
                                </li >
                                <li class="menu">
                                    <a href="#" class="item">
                                        <span> 
                                            <span class="mn">khuyến mãi</span>
                                        </span>
                                    </a>
                                </li >
                                <li class="menu">
                                    <a href="#" class="item" id="btn_giohang">
                                        <span> 
                                            <span  class="mn">giỏ hàng</span>
                                            <span  class="title">Có <span id="sosp"><?= $this->cart->total_items(); ?></span> sản phẩm</span>
                                        </span>
                                    </a>

                                </li >
                            </nav>
                        </div>


                    </div>

                </div>
                <!-- end div top-->	
                <script>
                    globalurl = "<?= base_url() ?>";
                </script>